﻿using System;

namespace Basics101_DisplayOutput
{
    /// <summary>
    /// Author: Mr. Jin Vincent N. Necesario
    /// Level: Beginner
    /// Problem: Write a program that displays your name inside a box on the terminal screen , like this
    /// ************
    /// * lockdown *
    /// ************
    /// Test Case:
    /// Input: Jin Vincent N. Necesario
    /// Output: 
    /// ****************************
    /// * Jin Vincent N. Necesario *
    /// ****************************
    /// </summary>
    class Program
    {
        static void CenterText(string outputToScreen)
        {
            int stringLength = outputToScreen.Length;

            Console.ForegroundColor = ((ConsoleColor)new Random().Next(1, 15)); 

            Console.Write(new string(' ', (Console.WindowWidth - stringLength) / 2));

            Console.WriteLine(outputToScreen);

            Console.Write(new string(' ', (Console.WindowWidth - stringLength) / 2));
        }

        static void Main(string[] args)
        {
            CenterText("Please enter your name:");
            
            string yourName = Console.ReadLine();

            string box = new string('*', yourName.Length + 4);

            CenterText(box);

            Console.WriteLine(string.Concat("* ", yourName, " *"));

            CenterText(box);

            Console.ReadKey();
        }
    }
}
